//
//  BQOAuthModel.swift
//  BQWB
//
//  Created by laibingqiang on 16/10/25.
//  Copyright © 2016年 laibingqiang. All rights reserved.
//

import UIKit

class BQOAuthModel: NSObject,NSCoding{
    
    /// 用户授权的唯一票据
    var access_token: String?
    /// access_token的生命周期，单位是秒数
    var expires_in:TimeInterval = 0{
        
        didSet{
            expires_date = Date().addingTimeInterval(expires_in)
        }
    }
    /// 授权用户的UID
    var uid: String?
    
    var screen_name:String?
    
    var avatar_large:String?
    
    var expires_date:Date?
    
    override var description: String{
        let keys = ["access_token", "expires_in", "uid","screen_name","avatar_large"]
        return dictionaryWithValues(forKeys: keys).description
    }

    override init() {
        super.init()
    }
    
    // 归档
    func encode(with aCoder: NSCoder) {
        self.yy_modelEncode(with: aCoder)
    }
    // 解档
    required init?(coder aDecoder: NSCoder) {
        super.init()
        self.yy_modelInit(with: aDecoder)
    }


}
